package cn.z2huo.datastructure.linearlist.doublelinkedlist;

import cn.z2huo.datastructure.linearlist.doublelinkedlist.entity.Node;

/**
 * 作者：张一卓
 * 创建日期：2020/9/27
 */
public class DoubleLinkedListUtils {
    public static <T> void printDoubleLinkedList(Node<T> root){
        int i = 0;
        System.out.println("===>>> 打印双向链表");
        Node<T> temp = root;
        while (temp != root || i == 0){
            if (i == 0){
                System.out.println("=> 头结点 " + root.getData());
            }else {
                System.out.println("=> 位置 " + (i - 1) + "     元素 " + root.getData());
            }
            root = root.getNext();
            i++;
        }
    }
}
